﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MongoDB.Bson;
using System.ComponentModel.DataAnnotations;
using MongoDB.Bson.Serialization.Attributes;

namespace Chaine.Models
{
    public class EventModels
    {
        public ObjectId Id { get; set; }
        [Required]
        public string Title { get; set; }
        public string Location { get; set; }
        public string Poster { get; set; }
        [Required]
        public string StartDate { get; set; }
        public string StartHour { get; set; }
        public string StartMin { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime StartDateTime
        {
            get
            {
                if (string.IsNullOrEmpty(StartDate) || string.IsNullOrEmpty(StartHour) || string.IsNullOrEmpty(StartMin))
                    return DateTime.MinValue;
                var result = DateTime.Parse(string.Format("{0} {1}:{2}", StartDate, StartHour, StartMin));
                return result;
            }
            set
            {

            }
        }
        [Required]
        public string EndDate { get; set; }
        public string EndHour { get; set; }
        public string EndMin { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime EndDateTime
        {
            get
            {
                if (string.IsNullOrEmpty(EndDate) || string.IsNullOrEmpty(EndHour) || string.IsNullOrEmpty(EndMin))
                    return DateTime.MinValue;
                var result = DateTime.Parse(string.Format("{0} {1}:{2}", EndDate, EndHour, EndMin));
                return result;
            }
            set
            {

            }
        }
        public bool IsDeleted { get; set; }
        [DataType(System.ComponentModel.DataAnnotations.DataType.Currency)]
        public decimal Price { get; set; }

        /// <summary>
        /// 活动内容
        /// </summary>
        public string Content { get; set; }
    }
}